package PAT;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class PAT1054 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                int num = scanner.nextInt();
                if(map.containsKey(num)){
                    map.put(num,map.get(num)+1);
                }else {
                    map.put(num,1);
                }
            }
        }
        int ans =-1<<30;
        int res= 0;
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            Integer value = entry.getValue();
            if(value>ans){
                ans = value;
                res = entry.getKey();
            }
        }
        System.out.println(res);
    }
}
